const wxaapi = require('./public/wxaapi.js');//api地址参数
const wxRequest = require('./utils/js/wxRequest.js'); //请求参数
const wxPromise = require('./utils/js/wxPromise.js').wxPromise;//promise信息
const wxAuth = require('./public/API/wxAuth.js');
App({
  onLaunch: function () {
    let _This=this;
  },
  globalData: {
    userInfo: null,
    sessionKey: "" 
  },
  /**
 * 获取用户登录信息
 */
  fGetUserData: function () {
    let _This = this;
    if (_This.globalData.userInfo && _This.globalData.userInfo.unionId) {  
      console.log("exist userinfo-------");
      return wxPromise(_This.globalData.userInfo);
    };
   return wxAuth.fGetSessionKey(_This, true).then(result => {
      return wxAuth.fAuthUserData(_This, result);
    }).then(userInfo => {
     // console.log("----11111------------", userInfo);
      _This.globalData.userInfo = userInfo;
      return userInfo;
    });

  },


})